package com.anny.crm.model;

import java.sql.Timestamp;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.hibernate.annotations.GenericGenerator;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Entity
@Table(name="users")
@NoArgsConstructor
@AllArgsConstructor
public class User {
	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name="uuid", strategy = "uuid")
	private String id; // 用户编号UUID
	@NotNull(message = "名字不能为空")
	private String loginName; // 登录名
	@NotNull(message = "密码不能为空")
	private String password; // 密码
	private String isLockOut; // 是否锁定
	private Timestamp createTime; // 账号创立时间
	private Timestamp lastLoginTime; // 最后一次登录时间
	private Timestamp lockTime; // 被锁定时间
	private Integer psdWrongTime; // 密码错误次数
	@Pattern(regexp = "^(.+)@(.+)$",message = "邮箱的格式不合法")
	private String protectEmail; // 密保邮箱
	@Pattern(regexp = "1[3|4|5|7|8][0-9]\\d{8}",message = "邮箱的格式不合法")
	private String protectMTel; // 密保手机号
	//UUID.randomUUID().toString();随机产生uuid带破折号的
}